<template>
  <div class="home">
    <div v-for="(item, index) in routes" :key="index">
      <span v-if="index > 4" class="btn" @click="goPage(item.path)">
        {{ item.meta.title }}
      </span>
    </div>
  </div>
</template>

<script>
import routes from '../../router/index'
export default {
  data() {
    return {
      routes: [],
    }
  },
  mounted() {
    //设置路由按钮
    this.routes = routes.options.routes
  },
  methods: {
    goPage(path) {
      this.$router.push(path)
    },
  },
  components: {},
}
</script>

<style lang="less" scoped>
.home {
  display: flex;
  flex-wrap: wrap;
  width: 100vw;
  height: auto;
  .btn {
    display: block;
    margin: 0.1rem 0.1rem;
    padding: 0.05rem;
    border: 0.02rem solid rgba(0, 0, 0, 0.5);
    margin-top: 0.2rem;
    box-sizing: border-box;
    background-color: #ccc;
    border-radius: 0.05rem;
  }
}
</style>
